From 0fea8c56d27c771e8a7fd9f2e5a52ac0d3eb2788 Mon Sep 17 00:00:00 2001 From: Jan Arne Petersen Date: Sun, 25 May 2008 12:29:19 +0000 Subject: [PATCH] Subtract logical.x from x to fix the wrong position for right and center 2008-05-25 Jan Arne Petersen * gtk/gtklabel.c: (get_layout_location): Subtract logical.x from x to fix the wrong position for right and center justified labels with logical.x > 0 (#530255). svn path=/trunk/; revision=20146 --- ChangeLog | 6 ++++++ gtk/gtklabel.c | 6 ++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index cfa0b4f4b8..078d4a1320 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2008-05-25 Jan Arne Petersen + + * gtk/gtklabel.c: (get_layout_location): Subtract logical.x from x to + fix the wrong position for right and center justified labels with + logical.x > 0 (#530255). + 2008-05-25 Jan Arne Petersen * gtk/gtkfilechooserdefault.c: diff --git a/gtk/gtklabel.c b/gtk/gtklabel.c index eb71103c63..0b86314fcb 100644 --- a/gtk/gtklabel.c +++ b/gtk/gtklabel.c @@ -2661,6 +2661,7 @@ get_layout_location (GtkLabel *label, GtkLabelPrivate *priv; gfloat xalign; gint req_width, x, y; + PangoRectangle logical; misc = GTK_MISC (label); widget = GTK_WIDGET (label); @@ -2671,13 +2672,13 @@ get_layout_location (GtkLabel *label, else xalign = 1.0 - misc->xalign; + pango_layout_get_pixel_extents (label->layout, NULL, &logical); + if (label->ellipsize || priv->width_chars > 0) { int width; - PangoRectangle logical; width = pango_layout_get_width (label->layout); - pango_layout_get_pixel_extents (label->layout, NULL, &logical); req_width = logical.width; if (width != -1) @@ -2694,6 +2695,7 @@ get_layout_location (GtkLabel *label, x = MAX (x, widget->allocation.x + misc->xpad); else x = MIN (x, widget->allocation.x + widget->allocation.width - misc->xpad); + x -= logical.x; y = floor (widget->allocation.y + (gint)misc->ypad + MAX (((widget->allocation.height - widget->requisition.height) * misc->yalign), -- 2.30.2